//引用封装页面的axios

import axios from '@/utils/myaxios.js'

//添加请求路径拼接端口
//登录
export const userlogin = function (data) {
  return axios(
    /*  给页面添加端口 */
    {
      url: '/login',
      method: 'post',
      data
    })
}

//注册
export const userregister = function (data) {
  return axios(
    {
      url: '/register',
      method: 'post',
      data
    }
  )
}

//请求用户信息
export const getUserid = (id) => {
  return axios({
    url: `/user/${id}`,
  })
}
//编辑用户信息
export const getUserchangeid = (id, data) => {
  return axios({
    method: 'post',
    url: `/user_update/${id}`,
    data
  })
}
//首页
export const userindex = function (data) {
  return axios(
    {
      url: '/index',
      method: 'post',
      data
    }
  )
}


export const userfollows = function (id) {
  // console.log('转关注了');
  return axios(
    {
      url: '/user_follows/' + id,

    }
  )
}
//获取用户的关注数据
export const getuserfollows = function () {
  // console.log('获取关注数据了');
  return axios(
    {
      url: '/user_follows/',

    }
  )
}
export const userunfollows = function (id) {
  // console.log('取消关注了');
  return axios(
    {
      url: '/user_unfollow/' + id,
    }
  )
}
export const getuserstarlist = function () {
  // console.log('获取收藏数据了');
  return axios(
    {
      url: '/user_star',
    }
  )
}
export const getusercommentslist = function () {
  // console.log('获取个人评论数据了');
  return axios(
    {
      url: '/user_comments',
    }
  )
}
